import { createStore, applyMiddleware } from "redux"
import rootReducer from "./reducers"
import thunk from "redux-thunk"
import { composeWithDevTools } from "redux-devtools-extension"
const store =  createStore(rootReducer ,composeWithDevTools(applyMiddleware(thunk)))
export default store



// import { createStore, applyMiddleware } from "redux"
// import rootReducer from "./reducers"
// import thunk from "redux-thunk"
// import { composeWithDevTools } from "redux-devtools-extension"
// import { getToken } from "@/utils/auth"

// // 可以在createStore的第二个参数的位置传入整个state的初始状态 
// // 可以从前端缓存中 将初始状态同步到 store
// // 创建一个大的状态，从前端缓存中同步已获取的token
// const initailState = {
//     login: getToken()
// }
// const store =  createStore(rootReducer, initailState ,composeWithDevTools(applyMiddleware(thunk)))
// export default store